﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/">
<!-- 下拉框 -->
<link rel="stylesheet" href="static/ace/css/chosen.css" />
<!-- jsp文件头和头部 -->
<%@ include file="../index/top.jsp"%>
<!-- 日期框 -->
<link rel="stylesheet" href="static/ace/css/datepicker.css" />
</head>
<body class="no-skin">

	<!-- /section:basics/navbar.layout -->
	<div class="main-container" id="main-container">
		<!-- /section:basics/sidebar -->
		<div class="main-content">
			<div class="main-content-inner">
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
						
						<!-- 检索  -->
						<form action="problem/getProblemList.do" method="post" name="goodsForm" id="goodsForm">
						<%-- <input type="hidden" name="classIds" id="classIds" value="${classIds}"/> --%>
					<%-- 	<table style="margin-top:5px;">
							<tr>
								<td>
									<div class="nav-search">
									<span class="input-icon">
										<input class="nav-search-input" id="name" type="text" name="name" value="${pd.name}" placeholder="这里输入负责人姓名" style="vertical-align:top;width: 190px;"/>
										<i class="ace-icon fa fa-search nav-search-icon"></i>
									</span>
									</div>
								</td>
								<td>
									<div class="nav-search">
									<span class="input-icon">
										<input class="nav-search-input" id="phone" type="text" name="phone" value="${pd.phone}" placeholder="这里输入负责人手机号" style="vertical-align:top;width: 190px;"/>
										<i class="ace-icon fa fa-search nav-search-icon"></i>
									</span>
									</div>
								</td>
								<c:if test="${QX.cha == 1 }">
								<td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs" onclick="searchs();"  title="检索"><i id="nav-search-icon" class="ace-icon fa fa-search bigger-110 nav-search-icon blue"></i></a></td>
								</c:if>
								<c:if test="${QX.toExcel == 1 }"><td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs" onclick="toExcel();" title="导出到EXCEL"><i id="nav-search-icon" class="ace-icon fa fa-download bigger-110 nav-search-icon blue"></i></a></td></c:if>
							</tr> 
						</table>--%>
						<!-- 检索  -->
					
						     <table id="simple-table" class="table table-striped table-bordered table-hover"  style="margin-top:5px;">
							  <thead>
							  
								<tr>
									<th class="center" style="width:50px;">排序</th>
									<th class="center">ID</th>
									<th class="center">序号</th>
									<th class="center">问题</th>
                                    <th class="center">所属上级</th>
									<th class="center">操作</th>
								</tr>
							</thead>
													
							<tbody id="goodlist">
								
							<!-- 开始循环 -->	
							<c:choose>
								<c:when test="${not empty problemList}">
									<c:if test="${QX.cha == 1 }">
									<c:forEach items="${problemList}" var="pl" varStatus="vs">
												
										<tr>
											<td class='center' style="width: 30px;">${vs.index+1}</td>
											<td class="center">${pl.id }</td>
											<td class="center">${pl.seat }</td>
											<td class="center"><a href="javascript:goSonClassify('${pl.id}')">${pl.problem_name}</a></td>
                                            <td class="center">${pl.parent_id == '0'? '根分类': pl.parentName}</td>
											<td class="center">
                                              	<c:if test="${QX.edit == 1 }">
                                                    <a class="green"
                                                       href="javascript:editClassify('${pl.id}');">
                                                        <i class="ace-icon fa fa-pencil-square-o bigger-130"
                                                           title="修改"></i>
                                                    </a>
                                                </c:if>
                                                <c:if test="${QX.del == 1 }">
                                                    <a class="red" href="javascript:delClassify('${pl.id}');">
                                                        <i class="ace-icon fa fa-trash-o bigger-130" title="删除"></i>
                                                    </a>
                                                </c:if>
											</td>
										</tr>
									
									</c:forEach>
									 </c:if>
									<c:if test="${QX.cha == 0 }">
										<tr>
											<td colspan="10" class="center">您无权查看</td>
										</tr>
									</c:if>
								</c:when>
								<c:otherwise>
									<tr class="main_info">	
										<td colspan="15" class="center">没有相关数据</td>
									</tr>
								</c:otherwise>
							</c:choose>
							</tbody>
						</table>
					<div class="page-header position-relative">
					<table style="width:100%;">
						<tr>
						<td style="vertical-align:top;"> <div>
                            &nbsp;&nbsp;
                            <c:if test="${QX.add == 1 }"><a class="btn btn-sm btn-success"
                                                            onclick="addClassify('${pd.id}');">新增</a></c:if>
                            <c:if test="${pd.id !=0}">
                                <a class="btn btn-sm btn-success" onclick="goSonClassify('${pd.pid}');">返回</a>
                            </c:if>
                        </div></td>
								<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
							</tr>
					</table>
					</div>
					</form>
	
						</div>
						<!-- /.col -->
					</div>
					<!-- /.row -->
				</div>
				<!-- /.page-content -->
			</div>
		</div>
		<!-- /.main-content -->

		<!-- 返回顶部 -->
		<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
			<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
		</a>

	</div>
	<!-- /.main-container -->

	<!-- basic scripts -->
	<!-- 页面底部js¨ -->
	<%@ include file="../index/foot.jsp"%>
	<!-- 删除时确认窗口 -->
	<script src="static/ace/js/bootbox.js"></script>
	<!-- ace scripts -->
	<script src="static/ace/js/ace/ace.js"></script>
	<!-- 日期框 -->
	<script src="static/ace/js/date-time/bootstrap-datepicker.js"></script>
	<!-- 下拉框 -->
	<script src="static/ace/js/chosen.jquery.js"></script>
	<!--提示框-->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
	</body>

<script type="text/javascript">
$(top.hangge());
//检索
function searchs(){
	top.jzts();
	$("#goodsForm").submit();
}
function goSonClassify(id) {
    top.jzts();
    window.location.href = "<%=basePath%>problem/getProblemList.do?id=" + id;
};

//编辑菜单
function editClassify(id) {
    top.jzts();
    window.location.href = "<%=basePath%>problem/toEdit.do?id=" + id;
};

//新增菜单
function addClassify(id) {
    top.jzts();
    window.location.href = "<%=basePath%>problem/toAdd.do?id="+id;
};

//删除
function delClassify(id) {
    bootbox.confirm("确定要删除吗?", function (result) {
        if (result) {
            var url = "<%=basePath%>problem/delProblem.do?id=" + id;
            top.jzts();
            $.get(url, function (data) {
                if ("success" == data) {
                	window.location.href = "<%=basePath%>problem/getProblemList.do?id=" +${pd.pid};
                } else if("NO-DEL" == data){
                	alert("此问题分类不能删除!");
                	window.location.href = "<%=basePath%>problem/getProblemList.do?id=" +${pd.pid};
                } else {
                	alert("网络繁忙!");
                	window.location.href = "<%=basePath%>problem/getProblemList.do?id=" +${pd.pid};
                }
            });
        }
    });
}

</script>
</html>
